package com.guit.hrms.mapper;

import com.guit.hrms.po.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface LoginMapper {
    /**
     * 登录验证
     * @param employeeId 员工号
     * @param password 密码
     * @return 员工信息
     */
    @Select("select employee_id,username,password,gender,age,phone_number,email,department,position,dept_type from employees where employee_id=#{employeeId} and password=#{password}")
    Employee Login(String employeeId, String password);

    /**
     * 绑定微信
     * @param employeeId 员工号
     * @param openid 微信openid
     * @return 影响行数
     */
    @Update("update employees set open_id=#{openid} where employee_id=#{employeeId}")
    Integer bindWeChat(String employeeId, String openid);

    /**
     * 微信登录
     * @param employeeId 员工号
     * @param md5Password 密码的md5值
     * @param openId 微信openid
     * @return 员工信息
     */
//    @Select("select employee_id,username,password,gender,age,phone_number,email,department,position,dept_type from employees where employee_id=#{employeeId} and password=#{md5Password} and open_id=#{openId}")
    Employee wxLogin(String employeeId, String md5Password, String openId);
}
